package com.sc.nft.task;

import com.sc.nft.dao.MetaMapSettleDao;
import com.sc.nft.service.MetaMapSettleService;
import com.sc.nft.service.NftRegionBindingService;
import com.sc.nft.service.UserWalletService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 版图任务
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class MetaMapTask {

    private final MetaMapSettleService metaMapSettleService;
    private final MetaMapSettleDao metaMapSettleDao;
    private final UserWalletService userWalletService;
    private final NftRegionBindingService nftRegionBindingService;

    /**
     * 发放燃料
     */
    @XxlJob("distributeFuel")
    public void distributeFuel() {
        metaMapSettleService.distributeFuel();
    }


    /**
     * 地图分润
     *
     * @throws Exception
     */
    @XxlJob("mapShareProfit")
    public void mapShareProfit() throws Exception {
        // 获取所有可以分润的地图.
        metaMapSettleDao.getShareProfitList().forEach(userWalletService::mapShareProfit);
    }



    /**
     * 更新活跃度
     */
    @XxlJob("nftBindActivation")
    public void nftBindActivation() {
        nftRegionBindingService.updateActivation();
    }

}
